# Maintainer: Alad Wenter <alad@archlinux.org>
# Maintainer: Christian Hesse <mail@eworm.de>
# Contributor: Giovanni Scafora <giovanni@archlinux.org>
# Contributor: Daniel Plaza <daniel.plaza.espi@gmail.com>

pkgname=pcsclite
pkgver=1.9.9
pkgrel=3
pkgdesc="PC/SC Architecture smartcard middleware library"
arch=('loong64' 'x86_64')
url='https://pcsclite.apdu.fr/'
license=('BSD')
depends=('libsystemd.so' 'libudev.so' 'libpolkit-gobject-1.so')
makedepends=('systemd' 'polkit')
optdepends=(
  'python: API call trace logging with the pcsc-spy'
  'ccid: USB Chip/Smart Card Interface Devices driver'
)
provides=('libpcsclite.so' 'libpcscspy.so')
validpgpkeys=('F5E11B9FFE911146F41D953D78A1B4DFE8F9C57E') # Ludovic Rousseau <rousseau@debian.org>
source=("https://pcsclite.apdu.fr/files/pcsc-lite-${pkgver}.tar.bz2"{,.asc})
sha256sums=('cbcc3b34c61f53291cecc0d831423c94d437b188eb2b97b7febc08de1c914e8a'
            'SKIP')

build() {
  cd "pcsc-lite-$pkgver"

  ./configure \
    --prefix=/usr \
    --sbindir=/usr/bin \
    --sysconfdir=/etc \
    --disable-static \
    --enable-filter \
    --enable-ipcdir=/run/pcscd \
    --enable-libudev \
    --enable-usbdropdir=/usr/lib/pcsc/drivers \
    --enable-polkit \
    --with-systemdsystemunitdir=/usr/lib/systemd/system

  make
}

package() {
  cd "pcsc-lite-$pkgver"
  make DESTDIR="$pkgdir" install

  install -D -m0644 "$srcdir/pcsc-lite-$pkgver/COPYING" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -d "$pkgdir/usr/lib/pcsc/drivers"
}

# vim:set sw=2 sts=-1 et:
